﻿using System;
using System.Threading.Tasks;
using eLibrary;
using eTime.Wheel;

namespace Letter.Net.Kcp;

class KcpTimer : ITimerTask
{
    public static Task DelayAsync(TimeSpan timeSpan)
    {
        var kcpTimer = new KcpTimer();
        TimerRunner.CreateTimeout(kcpTimer, timeSpan);
        return kcpTimer.tcs.Task;
    }

    private KcpTimer()
    {
        this.tcs = new TaskCompletionSource<int>();
    }

    private TaskCompletionSource<int> tcs;

    public void Run(ITimeout timeout)
    {
        tcs.SetResult(0);
    }
}